<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <title>Chain</title>

        <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
        <link rel="stylesheet" href="css/font-awesome.min.css">
        <link href="css/style.default.css" rel="stylesheet">
        <link href="css/select2.css" rel="stylesheet" />
        <link href="css/style.datatables.css" rel="stylesheet">
        <link href="css/dataTables.responsive.css" rel="stylesheet">
        <script src="js/jquery-1.11.1.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
         <link href="js/datePicker/jquery.datetimepicker.css" rel="stylesheet">
        <script src="js/datePicker/jquery.datetimepicker.full.min.js" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" href="css/pagination.css">
        <script src="js/bootstrap-paginator.min.js"></script>
      <!--   <script src="js/datePicker/locales/bootstrap-datetimepicker.zh-CN.js" type="text/javascript"></script> -->

        <script type="text/javascript">
        $(function () {
                    initDatePicker('query_submit_time');
                    initDatePicker('query_submit_time_1');
                    jlcx();
                });
         function initDatePicker(id){
        $('#'+id).datetimepicker({
                                  lang:'ch',
                                  maxDate:new Date(),
                                  minDate:'2015/01/01 01:00',
                                  defaultSelect:true,
                                  defaultDate:new Date(),
                                  todayButton:true,
                       //         timepicker:false,
                       //         minView: "month",//设置只显示到月份
                                  lang:'zh',
                                  format : "Y/m/d H:i"
                                  });
          }
      function jlcx() {
        $.ajax({
          type : "post",
          url : "CxtjController/cx.do",
          data : {
            "page" : "1",
            "keyWord" : $("#ipt_keyWord").val(),
            "userName": $("#ipt_username").val(),
            "mintime" : $("#query_submit_time").val(),
            "maxtime" : $("#query_submit_time_1").val()
          },
          dataType : "json",
          success : function(data) {
            $("#infoList tr").remove();
          //  alert(data[0].title);
            for (var o in data.datas) {
              var dateStr=new Date(data.datas[o].czsj).toLocaleString();
              $("#infoList").append(
                '<tr>'+
                '<td>'+data.datas[o].consql+'</td>'+
                    '<td>'+data.datas[o].sqluser+'</td>'+
                    '<td>'+data.datas[o].obj_NAME+'</td>'+
                    '<td>'+dateStr+'</td>'+
                '</tr>');
            }
            var options = {
              currentPage : 1, //当前页
              totalPages : Math.ceil(data.num/10), //每页数
              numberofPages : 5, //显示的页数
              itemTexts : function(type, page, current) { //修改显示文字
                switch (type) {
                case "first":
                  return "第一页";
                case "prev":
                  return "上一页";
                case "next":
                  return "下一页";
                case "last":
                  return "最后一页";
                case "page":
                  return page;
                }
              },
              onPageClicked : function(event, originalEvent, type, page) { //异步换页
                $.ajax({
                  type : "POST",
                  url : "CxtjController/cx.do",  //getGwByPag
                  data : {
                    "page" : page,
                    "keyWord" : $("#ipt_keyWord").val(),
                    "userName": $("#ipt_username").val(),
                    "mintime" : $("#query_submit_time").val(),
                    "maxtime" : $("#query_submit_time_1").val()
                  },
                  dataType : "json",
                  // jsonp:'jsonpCallback',
                  success : function(data) {
                    $("#infoList tr").remove();
                    for (var o in data.datas) {
                      var dateStr=new Date(data.datas[o].czsj).toLocaleString();
                      $("#infoList").append(
                          '<tr>'+
                            '<td>'+data.datas[o].consql+'</td>'+
                            '<td>'+data.datas[o].sqluser+'</td>'+
                            '<td>'+data.datas[o].obj_NAME+'</td>'+
                            '<td>'+dateStr+'</td>'+
                          '</tr>');}
                  }
                });

              }
            };
            $("#pageNo").bootstrapPaginator(options);
          }
        });
      }
    function btnSearch(){
/*      */
      //alert(maxtime);
      $("#infoList tr").remove();
      jlcx();
    }
    </script>
    </head>

    <body>
        <header>
            <div class="headerwrapper">
            <!--    <div class="header-left">
                    <a href="index.html" class="logo">

                    </a>
                </div> header-left -->
                <img src="images/logo.png" alt="" />
                

            </div><!-- headerwrapper -->
        </header>

        <section>
            <div class="mainwrapper">
                <div class="leftpanel">
                    <div class="media profile-left">
                        <a class="pull-left profile-thumb" href="profile.html">
                            <img class="img-circle" src="images/photos/profile.png" alt="">
                        </a>
                        <div class="media-body">
                            <h4 class="media-heading">Elen Adarna</h4>
                            <small class="text-muted">Beach Lover</small>
                        </div>
                    </div><!-- media -->
                    <h5 class="leftpanel-title">导航</h5>
                    <ul class="nav nav-pills nav-stacked">
                        <li><a href="index.html"><i class="fa fa-home"></i> <span>主页</span></a></li>
                        <li class="parent active"><a href=""><i class="fa fa-bars"></i> <span>信息查询</span></a>
                            <ul class="children">
                                <li class="active"><a href="search.html">日志查询</a></li>
                            </ul>
                        </li>
                         <li class="parent"><a href=""><i class="fa fa-edit"></i> <span>统计</span></a>
                            <ul class="children">
                                <li><a href="tj_yhbl.html">用户比例统计</a></li>
                            </ul>
                            <ul class="children">
                                <li><a href="tj_yhpm.html">用户排名统计</a></li>
                            </ul>
                            <ul class="children">
                                <li><a href="tj_bbl.html">表比例统计</a></li>
                            </ul>
                            <ul class="children">
                                <li><a href="tj_bpm.html">表排名统计</a></li>
                            </ul>
                        </li>
                        <li class="parent"><a href=""><i class="fa fa-exclamation-circle"></i> <span>警告通知</span></a>
                          <ul class="children">
                                <li><a href="czplsz.html">操作频率设置</a></li>
                                <li><a href="czjlssz.html">操作记录数设置</a></li>
                                <li><a href="tzck.html">通知查看</a></li>
                            </ul>
                        </li>
                        <li class="parent"><a href=""><i class="fa fa-cogs"></i> <span>系统管理</span></a>
                            <ul class="children">
                                <li ><a  href="user.html">用户管理</a></li>
                                <li><a href="jdck.html">节点查看</a></li>
                                <li><a href="tbEtl.html">数据抽取配置</a></li>
                            </ul>
                        </li>
                    </ul>
                </div><!-- leftpanel -->
<!-- menu end -->
                <div class="mainpanel">
                    <div class="pageheader">
                        <div class="media">
                            <div class="pageicon pull-left">
                                <i class="fa fa-th-list"></i>
                            </div>
                            <div class="media-body">
                                <ul class="breadcrumb">
                                    <li><a href=""><i class="glyphicon glyphicon-home"></i></a></li>
                                    <li><a href="">Tables</a></li>
                                    <li>查询</li>
                                </ul>
                                <h4>查询</h4>
                            </div>
                        </div><!-- media -->
                    </div><!-- pageheader -->
                    <div class="panel-body">
                                <form class="form-inline">
                                    <div class="form-group">
                                       <label>sql关键字：</label>
                                        <input class="form-control" id="ipt_keyWord" placeholder="输入" type="email">
                                    </div><!-- form-group -->

                                    <div class="form-group">
                                        <label>执行用户：</label>
                                        <input class="form-control" id="ipt_username" placeholder="输入用户名" type="text">
                                    </div><!-- form-group -->
                                
                                    <div class="form-group">
                                       <label>开始时间：</label>
                                       <input id="query_submit_time"  class="form-control" placeholder="选择开始时间" type="text">
                                    </div><!-- form-group -->

                                    <div class="form-group">
                                        <label>结束时间：</label>
                                        <input id="query_submit_time_1" class="form-control"  placeholder="选择结束时间" type="text">
                                    </div><!-- form-group -->
                                    <button id="SearchBTN" onclick="btnSearch()" type="button" class="btn btn-primary mr5">查询</button>
                                </form>
                            </div>

                    <div class="contentpanel">
                        <div class="panel panel-success-head">
                            <table id="shTable" class="table table-info mb30">
                                <thead class="">
                                    <tr>
                                        <th width="60%">sql内容</th>
                                        <th width="10%">用户</th>
                                        <th width="10%">操作对象</th>
                                        <th width="20%">时间</th>
                                    </tr>
                                </thead>
                                <tbody id="infoList">

                                </tbody>
                            </table>

                            <div id="pageNo" class="pagination">
                        </div><!-- panel -->

                    </div><!-- contentpanel -->
                </div><!-- mainpanel -->
            </div>
        </section>

        <script src="js/jquery-migrate-1.2.1.min.js"></script>
       <script src="js/modernizr.min.js"></script>
      <script src="js/pace.min.js"></script>
      <script src="js/retina.min.js"></script>
      <script src="js/jquery.cookies.js"></script>
      <script src="js/custom.js"></script>
        <script>
            jQuery(document).ready(function(){

                // Delete row in a table
                jQuery('.delete-row').click(function(){
                    var c = confirm("Continue delete?");
                    if(c)
                        jQuery(this).closest('tr').fadeOut(function(){
                        jQuery(this).remove();
                    });
                    return false;
                });

                // Show aciton upon row hover
                jQuery('.table tbody tr').hover(function(){
                    jQuery(this).find('.table-action-hide a').animate({opacity: 1},100);
                },function(){
                    jQuery(this).find('.table-action-hide a').animate({opacity: 0},100);
                });

            });
        </script>
    </body>
      <script src="js/my.js"></script>
        <script type="text/javascript">
        getUsername();
        </script>
</html>
